// BWGraphDocument.h -- the stitch document

#import <Cocoa/Cocoa.h>

@class BWGridGeometry;
@class BWGridAttributes;
@class BWLayerView;
@class BWPannerView;
@class BWColorKey;
@class BWLayerSet;
@class BWTool;
@class BWFabric;
@class BWDocumentMetadata;


extern NSString *BWGraphDocument_DocumentDeactivateNotification;
extern NSString *BWGraphDocument_DocumentActivateNotification;
extern NSString *BWGraphDocument_ToolChangeNotification;

@interface BWGraphDocument : NSDocument
{
    BWDocumentMetadata *metadata;
    
    BWFabric *fabric;
    BWGridGeometry *controllingGeometry;
    BWGridAttributes *gridAttributes;

    IBOutlet BWLayerView *layerView;
    IBOutlet NSScrollView *layerViewScrollView;

    IBOutlet NSArrayController *colorKeyController;
    NSMutableArray *colorKeyArray; // array of BWThreadColors

    IBOutlet NSTableView *colorKeyTableView;

    BWColorKey *colorKey;
    BWLayerSet *layers;

    BWTool *currentTool;

    IBOutlet NSSegmentedControl *tools;
    IBOutlet NSTextField *statusLine;

    BOOL documentFromFile;
}

- (IBAction) handleZoom: (id) sender;
- (IBAction) handleDisplayType: (id) sender;

- (BWColorKey *) colorKey;

// scaffolding 
- (void) redraw;

- (IBAction) addBackStitchLayer: (id) sender;
- (IBAction) addCrossStitchLayer: (id) sender;

@end // BWGraphDocument


// !!! total hack for bootstrapping layers
extern BWGraphDocument *g_globalDocument;
